@(result: uk.bl.monitrix.model.SearchResult, hostCount: Long, queryType: String, extraParams: String)

@import tags.{ navbar, embedParam }

@main("Monitrix - Host Information") {
  @navbar("")
}{
  <div class="container-fluid" style="padding-bottom:40px;">
    <div class="offset2 row">
      <h4 style="margin-left:5px;">
      @if(queryType != null) {
        <em>@queryType</em> @result.query
      } else {
        @result.query
      }
      </h4>
    </div>
    
    <div class="row-fluid">
      <!-- Sidebar -->
      <div class="span2" style="position:relative; left:-15px; padding-top:15px; padding-right:0px;">
        <p>
          <small><span style="color:#888">Took @result.took ms</span></small>
        </p>     
      </div>
      
      <!-- Result list -->
      <div class="span10">
        <div class="monitrix-tabs">
          @if(hostCount != null) {
            <a href="@routes.Search.search()?query=@result.query&type=hostname@embedParam("&")" class="monitrix-tab">@hostCount Hosts</a>
          }
          <a href="#" class="monitrix-tab monitrix-tab-active">@result.totalResults URLs</a>
          <span style="float:right;padding-right:10px;"><a href="@routes.Search.search()@embedParam()">Advanced Search</a></span>  
        </div>
        <div class="pagination">
          <ul>
            @if(result.offset > 0) {
              <li><a href="/search?query=@result.query&type=@queryType&limit=@result.limit&offset=@{Math.max(0, result.offset - result.limit)}@extraParams@embedParam("&")">&laquo;</a></li>
            } else {
              <li class="disabled"><a href="#">&laquo;</a></li>
            }
            <li class="disabled"><a href="#">Showing Results @{result.offset + 1} - @{Math.min(result.offset + result.limit, result.totalResults)}</a></li>
            @if(result.offset + result.limit < result.totalResults) {
              <li><a href="/search?query=@result.query&type=@queryType&limit=@result.limit&offset=@{result.offset + result.limit}@extraParams@embedParam("&")">&raquo;</a></li>
            } else {
              <li class="disabled"><a href="#">&raquo;</a></li>
            }
          </ul>
        </div>
        
        @for(item <- result.resultPage) {
          <p>
            <a href="@routes.URLs.getURLInfo(java.net.URLEncoder.encode(item.title, "UTF-8"))@embedParam()">@item.title</a><br/>
            <span style="font-family:Courier">@item.description</span>
          </p>
        }
      </div>
    </div>
  </div>
}